package cate.game.role.farm.endless.msg;

import cate.common.table.d.GDEndless;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgOutput;
import cate.game.client.msg.id.MsgIdBEndless;
import cate.game.res.MixRes;
import cate.game.role.Role;
import easy.java.dev.note.NoteField;

@ClientMsg(title = "挑战结果 の 通知")
public class EndlessChallengeResultResp implements MsgOutput {
    @NoteField(value = "这一波挑战结束的原因", detail = "0:挑战死亡,1:主动退出,2:已达到最大挑战关数,3:单纯因为跨天而结束")
    public byte reason;

    @NoteField(value = "日常奖励", detail = "如果为null，代表没有奖励")
    public MixRes reward;

    public EndlessChallengeResultResp() {

    }

    /** 结束的时候，会试图领取日常奖励的，当然也可能领不到 */
    public EndlessChallengeResultResp(GDEndless.ChallengeResult result, Role role) {
        this.reason = (byte) result.ordinal();
        this.reward = role.getFarm().endless.tryToGetReward();
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBEndless.CHALLENGE_RESULT_RESP;
    }
}
